﻿//-----------------------------------------------------------------------
// <copyright file="MachineDataContract.cs" company="CodePlex">
//     Copyright (c) Doug Holland, CodePlex. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace CodePlex.Diagnostics.Silverlight.Contracts
{
    using System;

    using System.Collections.Generic;
    using System.Collections.ObjectModel;

    using System.Diagnostics;
    using System.Diagnostics.CodeAnalysis;

    using System.Globalization;

    using System.Net;

    using System.Runtime.Serialization;

    /// <summary>
    /// Defines the data contract representing the details of a machine.
    /// </summary>
    [DataContract(Name = "MachineDataContract", Namespace = "http://schemas.datacontract.org/2004/07/CodePlex.Diagnostics.Contracts")]
    public sealed class MachineDataContract
    {
        #region public MachineDataContract()

        /// <summary>
        /// Initializes a new instance of the <see cref="T:MachineDataContract"/> class.
        /// </summary>
        public MachineDataContract()
        {
            this.MachineName = null;

            this.InstalledMemory = null;

            this.InstalledMemorySpeed = null;

            this.OperatingSystem = Environment.OSVersion.ToString();

            this.ProcessorCount = null;
        }

        #endregion

        #region public long? InstalledMemory

        /// <summary>
        /// Gets the total memory in bytes installed within the machine.
        /// </summary>
        /// <value>The total memory in bytes installed within the machine.</value>
        [DataMember]
        public long? InstalledMemory
        {
            get;
            private set;
        }

        #endregion

        #region public int? InstalledMemorySpeed

        /// <summary>
        /// Gets the speed of the slowest memory module installed within the machine.
        /// </summary>
        /// <value>The speed of the slowest memory module installed within the machine.</value>
        [DataMember]
        public int? InstalledMemorySpeed
        {
            get;
            private set;
        }

        #endregion

        #region public string IPAddress

        /// <summary>
        /// Gets the IP address of the machine the associated process is running on.
        /// </summary>
        /// <value>The IP address of the machine the associated process is running on.</value>
        [DataMember]
        public string IPAddress
        {
            get;
            private set;
        }

        #endregion

        #region public string OperatingSystem

        /// <summary>
        /// Gets the name of the operating system the associated process is running upon.
        /// </summary>
        /// <value>The name of the operating system the associated process is running upon.</value>
        [DataMember]
        public string OperatingSystem
        {
            get;
            private set;
        }

        #endregion

        #region public string MachineName

        /// <summary>
        /// Gets the name of the machine the associated process is running upon.
        /// </summary>
        /// <value>The name of the machine that the associated process is running upon.</value>
        [DataMember]
        public string MachineName
        {
            get;
            private set;
        }

        #endregion

        #region public int? ProcessorCount

        /// <summary>
        /// Gets the number of logical processors on the machine.
        /// </summary>
        /// <value>The number of logical processors on the machine.</value>
        [DataMember]
        public int? ProcessorCount
        {
            get;
            private set;
        }

        #endregion
    }
}
